package com.group.three.controller.order;

import com.group.three.entity.OrderLog;
import com.group.three.service.OrderService;
import com.group.three.vo.JsonResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 店铺端,订单日志接口
 *
 * @author Chopper
 * @since 2020/12/5
 **/
@RestController
@Api(tags = "店铺端,订单日志接口")
@RequestMapping("/store/order/orderLog")
public class OrderLogStoreController {


    @Autowired
    private OrderService orderService;

    @ApiOperation(value = "通过订单编号获取订单日志")
    @ApiImplicitParam(name = "orderSn", value = "订单编号", required = true, paramType = "path")
    @GetMapping(value = "/{orderSn}")
    public JsonResult get(@PathVariable String orderSn) {
        //订单日志
        List<OrderLog> orderLogs = orderService.selectBuyerOrderItemLog(orderSn);
        if (orderLogs != null) {
            return new JsonResult("200", "订单日志查询成功", orderLogs);
        }
        return new JsonResult("400", "订单日志查询成功");
    }
}